home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 1.8 KB | 87 lines | [TEXT/MPS ] |
- (* Sample snippet that demonstrates how to work-around the
- 'dctb' bug in the ImageWriter II 6.1 and 7.0 drivers.
- Bug causes a crash when doing a style dialog
- after setting draftbits with PrGeneral.
- *)
-
- {
- What's what in the code snippet that follows.
-
- thePrRecHdl : THPrint;
- rslData : TSetRslBlk;
- draftData : TDftBitsBlk;
- rotnData : TGetRotnBlk;
- isBadImageWriter: Boolean;
- isLandscape : Boolean;
- isReduced : Boolean;
- }
-
- PrOpen;
-
- IF (PrError = noErr) THEN
- BEGIN
-
- PrintDefault(thePrRecHdl);
-
- IF (PrError = noErr) THEN
- BEGIN
-
- {See if we're using a version 6.1 or 7.0 ImageWriter driver.}
-
- IF (thePrRecHdl^^.prStl.wDev DIV 256) = 1 THEN
- isBadImageWriter := (PrDrvrVers = 61) OR (PrDrvrVers = 70)
- ELSE
- isBadImageWriter := FALSE;
-
- IF NOT (isBadImageWriter) THEN
- BEGIN
-
- {Set draftBits mode now, if not our special case.}
-
- draftData.iOpCode := draftBitsOp;
- draftData.hPrint := thePrRecHdl;
- PrGeneral(@draftData);
-
- END;
-
- {Do the style dialog.}
-
- IF (PrStlDialog(thePrRecHdl)) THEN
- IF (isBadImageWriter) THEN
- BEGIN
-
- {If so, see if they selected rotation or 50% reduction.}
-
- rotnData.iOpCode := getRotnOp;
- rotnData.hPrint := thePrRecHdl;
- PrGeneral(@rotnData);
-
- isLandscape := rotnData.fLandscape;
-
- isReduced := BTst(thePrRecHdl^^.prStl.wDev, 3);
-
- {If so, warn them that those things will be ignored.
- Preferably use something other than DebugStr… }
-
- IF (isLandscape) OR (isReduced) THEN
- DebugStr('Bad ImageWriter; landscape and/or reduced.');
-
- {Now, set draftBits mode, since we didn't before.}
-
- draftData.iOpCode := draftBitsOp;
- draftData.hPrint := thePrRecHdl;
- PrGeneral(@draftData);
-
- END;
-
- IF (PrJobDialog(thePrRecHdl)) THEN
- BEGIN
-
- {Print}
-
- END;
- END;
- END;
-
- PrClose;
-